package com.example.demo.mcp.webserver;

import io.modelcontextprotocol.client.transport.ServerParameters;
import io.modelcontextprotocol.client.transport.StdioClientTransport;
import io.modelcontextprotocol.json.McpJsonMapper;

import java.io.File;

/**
 * @author zwg
 * @date 2025/9/24 22:15
 */
public class ClientStdio {
    public static void main(String[] args) {

        System.out.println(new File(".").getAbsolutePath());

        var stdioParams = ServerParameters.builder("java")
                .args("-Dspring.ai.mcp.server.stdio=true", "-Dspring.main.web-application-type=none",
                        "-Dlogging.pattern.console=", "-jar",
                        "/Users/mac/code/myspace/spring-demo3/demo-ai/demo-springai-mcp-webserver/target/demo-springai-mcp-webserver-1.0.0-SNAPSHOT.jar")
                .build();

        var transport = new StdioClientTransport(stdioParams, McpJsonMapper.createDefault());

        new SampleClient(transport).run();
    }
}
